<!DOCTYPE html>

<html>
	<title> 编辑修改zip包 </title>
	<head>
		<meta http-equiv="Content-Type" content="text/css; charset=utf-8">

        <link rel="stylesheet" href="{{ static_url('css/bootstrap.min.css') }}">
		<script src="{{ static_url("js/utils.js")}}"></script>
		<script src="{{ static_url("js/jquery.min.js")}}"></script>

		<style type="text/css">
			body {
				/*text-align: 	center;*/
				font-family: 	verdana;
			}

			.total {
                margin:         0 auto;
                text-align:     center;
                margin-top:     3cm;
                margin-bottom:  1cm;
                witdh:          18cm;
            }

			div.content {
				margin-left: 	4cm;
				margin-top: 	2cm;
			}

			span.item {
				display:		-moz-inline-box;
				display:		inline-block;
				width:			100px; 
				margin-bottom: 	10px;
			}

		</style>

	</head>
	
	<body>
		<span id="_id" hidden="true">{{ datas['_id'] }}</span>

		<div class="content">
            <h3>编辑修改:</h3>
            <span class="item"> zip文件名 </span>:
            <span class="item"> {{datas['filename']}} </span> </br>

            <span class="item"> md5 </span>:
            <span class="item"> {{datas['md5']}} </span> </br>

            <span class="item"> 被升级版本 </span>:
            <span class="item"> {{datas['ver_from']}} </span> </br>

            <span class="item"> 升级后版本 </span>:
            <span class="item"> {{datas['ver']}} </span> </br>

            <span class="item"> 上传时间 </span>:
            <span class="item"> {{datas['create_time']}} </span> </br>

            <span class="item"> zip包大小 </span>:
            <span class="item"> {{ str(int(datas['size']) / 1000) + " Kb"}} </span> </br>

            <span class="item"> 指纹号 </span>:
            <span class="item"> <input id="finger_point" type="text" value="{{datas['finger_point']}}" style="width:500px; font-size:15px;"/></span> </br>

            <span class="item"> 下载地址 </span>:
            <span class="item"> {{datas['download_url']}} </span> </br>

            <span class="item"> 当前域 </span>:
            <span class="item"> {{ "测试" if datas['scope'] == "test" else "正式" }} </span> </br>

            <span class="item"> 状态 </span>:
            <span class="item"> {{ "已激活" if datas['status'] == "1" else "未激活" }} </span> </br>

            <span class="item"> 说明 </span>:
            <span class="item"> <textarea id="change_logs" name="change_logs" style="width:300px; height:80px; font-size:15px;" warp="virtual">{{datas['info']}}</textarea> </span> </br>

            <div style="margin: 1cm 0cm 0cm 2cm">
                <button type="button" class="btn btn-success" id="edit"> 修改 </button>
                <button type="button" class="btn btn-success" id="cancel"> 取消 </button>
            </div>
    	</div>

	</body>
</html>


<script type="text/javascript">

	$("button#edit").click(function() {
		var confirm = window.confirm("确定提交更新?");
		if (confirm != true) {
			return;
		}

		var _id = $("span#_id").text();
		var finger_point = $("input#finger_point").val();
		var change_logs = $("textarea#change_logs").val();
		console.log("_id:" + _id + ", finger_point:" + finger_point + ", change_logs:" + change_logs);

		var params = {
			_id: 			_id,
			finger_point: 	finger_point,
			change_logs: 	change_logs
		};
		$.post(getLocalHost() + "/manage/edit", params,
			function(msg, status, xhr) {
				console.log("msg: " + JSON.stringify(msg));
				alert(msg.info);
		});
		window.location.href = '/';
	});

	$("button#cancel").click(function() {
        window.location.href = '/';
	});




</script>
